updating oE keys

keys

include map.e 
namespace map 
public function keys(map the_map_p, integer sorted_result = 0) 

returns all keys in a map.

Parameters:
  1. the_map_p: the map being queried
  2. sorted_result: optional integer. 0 [default] means do not sort the output and 1 means to sort the output before returning.
Returns:

A sequence made of all the keys in the map.

Comments:

If sorted_result is not used, the order of the keys returned is not predicable.

Example 1:
map the_map_p 
the_map_p = new() 
put(the_map_p, 10, "ten") 
put(the_map_p, 20, "twenty") 
put(the_map_p, 30, "thirty") 
put(the_map_p, 40, "forty") 
 
sequence keys 
keys = keys(the_map_p) -- keys might be {20,40,10,30} or some other order 
keys = keys(the_map_p, 1) -- keys will be {10,20,30,40} 
See Also:

has, values, pairs

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu